home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / prog_bas / easynet.zip / DEMO.ZIP / DIAGRAM.FRM < prev    next >
Text File  |  1996-01-01  |  6KB  |  246 lines

  1. VERSION 4.00
  2. Begin VB.Form Form3 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    Caption         =   "Example 3: Diagrams"
  6.    ClientHeight    =   3765
  7.    ClientLeft      =   1095
  8.    ClientTop       =   1485
  9.    ClientWidth     =   5445
  10.    FillColor       =   &H0000FFFF&
  11.    BeginProperty Font 
  12.       name            =   "MS Sans Serif"
  13.       charset         =   1
  14.       weight          =   700
  15.       size            =   8.25
  16.       underline       =   0   'False
  17.       italic          =   0   'False
  18.       strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H80000008&
  21.    Height          =   4170
  22.    Left            =   1035
  23.    LinkTopic       =   "Form3"
  24.    MDIChild        =   -1  'True
  25.    ScaleHeight     =   3765
  26.    ScaleWidth      =   5445
  27.    Tag             =   "3"
  28.    Top             =   1140
  29.    Width           =   5565
  30.    Begin VBX.EasyNet Net1 
  31.       Alignment       =   7  'Center - MIDDLE
  32.       AutoScroll      =   -1  'True
  33.       BackColor       =   &H00C0C0C0&
  34.       DrawColor       =   &H000000FF&
  35.       DrawWidth       =   1
  36.       FillColor       =   &H0000FFFF&
  37.       FontBold        =   0   'False
  38.       FontItalic      =   0   'False
  39.       FontName        =   "MS Sans Serif"
  40.       FontSize        =   8.25
  41.       FontStrikethru  =   0   'False
  42.       FontUnderline   =   0   'False
  43.       ForeColor       =   &H00000000&
  44.       Height          =   3195
  45.       Hiding          =   0   'False
  46.       ImageFile       =   ""
  47.       Left            =   210
  48.       License         =   "DIAGRAM.frx":0000
  49.       MultiSel        =   -1  'True
  50.       ScrollBars      =   3  'Both
  51.       ShowGrid        =   -1  'True
  52.       TabIndex        =   0
  53.       Top             =   300
  54.       Version         =   183
  55.       Width           =   3795
  56.       xGrid           =   150
  57.       yGrid           =   150
  58.    End
  59. End
  60. Attribute VB_Name = "Form3"
  61. Attribute VB_Creatable = False
  62. Attribute VB_Exposed = False
  63. Option Explicit
  64.  
  65. Dim n%, flag%
  66. Dim Node(1 To 4) As Long
  67. Dim X0&, Y0&
  68.  
  69. Private Sub banner3()
  70.   Net1.Transparent = True
  71.  
  72.   Net1.EditAction = 0
  73.   Net1.X1 = 600
  74.   Net1.Y1 = 200
  75.   Net1.X2 = Net1.X1 + 500
  76.   Net1.Y2 = Net1.Y1 + 500
  77.   Net1.Transparent = False
  78.   Node(1) = Net1.Item
  79.   Net1.Sleeping = True
  80.  
  81.   Net1.EditAction = 0
  82.   Net1.X1 = 2100
  83.   Net1.Y1 = 200
  84.   Net1.X2 = Net1.X1 + 500
  85.   Net1.Y2 = Net1.Y1 + 500
  86.   Node(2) = Net1.Item
  87.  
  88.   Net1.EditAction = 0
  89.   Net1.X1 = 1600
  90.   Net1.Y1 = 1700
  91.   Net1.X2 = Net1.X1 + 500
  92.   Net1.Y2 = Net1.Y1 + 500
  93.   Node(3) = Net1.Item
  94.  
  95.   Net1.EditAction = 0
  96.   Net1.X1 = 100
  97.   Net1.Y1 = 1700
  98.   Net1.X2 = Net1.X1 + 500
  99.   Net1.Y2 = Net1.Y1 + 500
  100.   Node(4) = Net1.Item
  101.  
  102.   Net1.Org = Node(1)
  103.   Net1.Dst = Node(2)
  104.   Net1.EditAction = 1
  105.  
  106.   Net1.Org = Node(2)
  107.   Net1.Dst = Node(3)
  108.   Net1.EditAction = 1
  109.  
  110.   Net1.Org = Node(3)
  111.   Net1.Dst = Node(4)
  112.   Net1.EditAction = 1
  113.  
  114.   Net1.Org = Node(1)
  115.   Net1.Dst = Node(4)
  116.   Net1.EditAction = 1
  117.  
  118.   Net1.Org = Node(1)
  119.   Net1.Dst = Node(3)
  120.   Net1.EditAction = 1
  121.  
  122.   Net1.Item = 0
  123. End Sub
  124.  
  125. Private Sub Form_Activate()
  126.   ActivateForm
  127. End Sub
  128.  
  129. Private Sub Form_Deactivate()
  130.   DeactivateForm
  131. End Sub
  132.  
  133. Private Sub Form_Load()
  134.   MDI1.ShowExample(2).Enabled = False
  135.   n = 1
  136.   flag = False
  137.  
  138.   SpeedON Net1
  139.   banner3
  140.   SpeedOFF Net1
  141. End Sub
  142.  
  143. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  144.   CursorShape Net1
  145. End Sub
  146.  
  147. Private Sub Form_Resize()
  148.   If WindowState <> 1 And ScaleHeight <> 0 Then
  149.     Net1.Visible = False
  150.     Net1.Top = 0
  151.     Net1.Left = 0
  152.     Net1.Height = ScaleHeight
  153.     Net1.Width = ScaleWidth
  154.     Net1.Visible = True
  155.   End If
  156. End Sub
  157.  
  158. Private Sub Form_Unload(Cancel As Integer)
  159.   MDI1.ShowExample(2).Enabled = True
  160.   MDI1.Command5.Enabled = False
  161.   MDI1.Command5.Caption = "Comments "
  162. End Sub
  163.  
  164. Private Sub Net1_AddLink()
  165.   If flag = True Then
  166.     flag = False
  167.   End If
  168. End Sub
  169.  
  170. Private Sub Net1_AddNode()
  171.   ' Avoid too small nodes
  172.   If Net1.X2 - Net1.X1 < 500 Then Net1.X2 = Net1.X1 + 500
  173.   If Net1.Y2 - Net1.Y1 < 500 Then Net1.Y2 = Net1.Y1 + 500
  174.  
  175.   Net1.Text = Str(n)
  176.   n = n + 1
  177. End Sub
  178.  
  179. Private Sub Net1_KeyDown(KeyCode As Integer, Shift As Integer)
  180.   Dim l&
  181.  
  182.   Select Case KeyCode
  183.   Case KEY_DELETE
  184.     Net1.EditAction = 2
  185.   Case KEY_LEFT
  186.     l = SendMessage(Net1.hWnd, WM_HSCROLL, SB_LINEUP, 0)
  187.   Case KEY_RIGHT
  188.     l = SendMessage(Net1.hWnd, WM_HSCROLL, SB_LINEDOWN, 0)
  189.   Case KEY_DOWN
  190.     l = SendMessage(Net1.hWnd, WM_VSCROLL, SB_LINEDOWN, 0)
  191.   Case KEY_UP
  192.     l = SendMessage(Net1.hWnd, WM_VSCROLL, SB_LINEUP, 0)
  193.   Case KEY_NEXT
  194.     l = SendMessage(Net1.hWnd, WM_VSCROLL, SB_PAGEDOWN, 0)
  195.   Case KEY_PRIOR
  196.     l = SendMessage(Net1.hWnd, WM_VSCROLL, SB_PAGEUP, 0)
  197.   End Select
  198. End Sub
  199.  
  200. Private Sub Net1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  201.   If Net1.PointedArea = 5 Then
  202.     flag = True
  203.     X0 = X
  204.     Y0 = Y
  205.   End If
  206. End Sub
  207.  
  208. Private Sub Net1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  209.   CursorShape Net1
  210. End Sub
  211.  
  212. Private Sub Net1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  213.   Dim Xabs, Yabs As Single
  214.  
  215.   If flag = True Then
  216.     flag = False
  217.  
  218.     If (Abs(X - X0) < 300 And Abs(Y - Y0) < 300) Then
  219.       Exit Sub
  220.     End If
  221.  
  222.     ' Origin node of next created link
  223.     Net1.Org = Net1.Item
  224.  
  225.     ' No current item
  226.     Net1.Item = 0
  227.  
  228.     Xabs = X + Net1.xScroll
  229.     Yabs = Y + Net1.yScroll
  230.  
  231.     ' Create destination node
  232.     Net1.X1 = Xabs - 300
  233.     Net1.X2 = Xabs + 300
  234.     Net1.Y1 = Yabs - 300
  235.     Net1.Y2 = Yabs + 300
  236.     Net1.EditAction = 0
  237.  
  238.     ' Destination node of next created link
  239.     Net1.Dst = Net1.Item
  240.  
  241.     ' Create link
  242.     Net1.EditAction = 1
  243.   End If
  244. End Sub
  245.  
  246.